Version

BinarySearch<T>(IList<T>,Func<T,Int32>) Method

Conducts a binary search for a value in the list using a given comparison function.
Syntax
'Declaration
 
Public Overloads Shared Function BinarySearch(Of T)( _
   ByVal list As IList(Of T), _
   ByVal comparisonFunction As Func(Of T,Integer) _
) As Integer
public static int BinarySearch<T>( 
   IList<T> list,
   Func<T,int> comparisonFunction
)

Parameters

list
The list of items to search.
comparisonFunction
A comparison function used for finding the target item in the list.

Type Parameters

T
The Type of items in the list.

Return Value

The index of the found item in the list.
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also